home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17689 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  963 b 

  1. Path: newshost.uwo.ca!usenet
  2. From: Sharon Wang <swang1@julian.uwo.ca>
  3. Newsgroups: comp.lang.c++
  4. Subject: Recursive CONSTRUCTOR allowed?
  5. Date: 17 Apr 1996 00:05:25 GMT
  6. Organization: UWO, London, Canada
  7. Message-ID: <4l1ck5$pit@falcon.ccs.uwo.ca>
  8. NNTP-Posting-Host: ts3-76.slip.uwo.ca
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Authenticated: swang1@ts3-76.slip.uwo.ca
  13. X-Mailer: Mozilla 1.22 (Windows; I; 16bit)
  14.  
  15. I'd like to implement the following algorithm using constructor
  16. (I am TOLD to do so)
  17.  
  18. // create an n linked list
  19. create node(n)
  20. {
  21.     if (n = 0) then
  22.         reach the length, don't create!
  23.     else
  24.         create this node;
  25.         create node(n-1);
  26.         make link;
  27.     end if
  28.     return;
  29. }
  30.  
  31. (1) FIrst of all, does this make sense?
  32. (2) Is is possible to use constructor instead of member function?
  33.  
  34. Any suggestion + plus small piece of code is highly appreciated.
  35.  
  36. Sharon
  37. <swang1@julian.uwo.ca>
  38.  
  39.  
  40.